<?php

require_once('gbif.general.php');
require_once('gbif.meta.php');

/**
 * Class Occurrence
 * Functionalities common to the templates
 */
class Occurrence extends General{
	public $meta;

	public $occurrenceFilename = 'occurrence.csv';

	public $occurrenceIndex = 1;

	public $occurrenceOutputHeaderList = array(
			'occurrenceID'
		,	'institutionCode'
		,	'collectionID'
		,	'collectionCode'
		,	'catalogNumber'
		,	'sex'
		,	'kingdom'
		,	'phylum'
		,	'class'
		,	'order'
		,	'family'
		,	'genus'
		,	'subgenus'
		,	'specificEpithet'
		,	'infraspecificEpithet'
		,	'scientificName'
		,	'scientificNameAuthorship'
		,	'taxonRank'
		,	'dateIdentified'
		,	'identifiedBy'
		,	'typeStatus'
		,	'continent'
		,	'waterBody'
		,	'country'
		,	'stateProvince'
		,	'locality'
		,	'decimalLatitude'
		,	'decimalLongitude'
		,	'coordinatePrecision'
		,	'minimumElevationInMeters'
		,	'maximumElevationInMeters'
		,	'minimumDepthInMeters'
		,	'maximumDepthInMeters'
		,	'basisOfRecord'
		,	'eventDate'
		,	'year'
		,	'month'
		,	'day'
		,	'habitat'
		,	'fieldNumber'
		,	'recordedBy'
		,	'samplingProtocol'
		,	'associatedMedia'
		,	'eventRemarks'
		,	'modified'
	);

	public function __construct( $file = NULL ) {
		parent::__construct($file);
		$this->meta = new Meta;
	}

	public function openFile() {
		if (!$this->fileOpen) return $this->openExcel();
		return true;
	}

	public function getIndexes() {
		return( array(
				"occurrence" => $this->occurrenceIndex
		));
	}

	public function getList( $list, $delimiter = '|' ) {
		return( explode($delimiter, $list) );
	}

	public function getFilenames() {
		$list = array( $this->occurrenceFilename );
		return( $list );
	}

}
?>